package ldh.im.fxbase.data.pojo.status;

import ldh.rpc.dto.ValueEnum;
import ldh.im.dto.enums.GroupType;

public enum ImGroupType implements ValueEnum<Byte> {
    chat(1, "聊天"),
    ;

    private Byte value;
    private String desc;

    private ImGroupType(Integer value, String desc){
        this.value = value.byteValue();
        this.desc = desc;
    }

    @Override
    public Byte getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static ImGroupType getByValue(Integer value) {
        if (value == null) return null;
        for (ImGroupType groupType : ImGroupType.values()) {
            if (groupType.getValue() == value.byteValue()) {
                return groupType;
            }
        }

        throw new RuntimeException("ImGroupType不支持这个值：" + value);
    }

    public static ImGroupType wrap(GroupType groupType) {
        if (groupType == GroupType.chat) {
            return chat;
        }

        throw new RuntimeException("ImGroupType不支持这个值：" + groupType);
    }
}
